from django.db import models
from app.models import UserInfo
import uuid

# 文章分类
class ActicleType(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.TextField()

# 文章列表
# name文章名称
# content文章内容
# user文章对应的用户
# createDate创建时间
# modifyDate修改时间
# likeLen点赞数
# collectLen收藏数
# acticleType文章类型
class ActicleList(models.Model):
    id = models.UUIDField(primary_key=True,default = uuid.uuid1)
    name = models.TextField(max_length=50)
    content = models.TextField()
    user = models.ForeignKey(UserInfo,on_delete=models.CASCADE)
    createDate = models.DateTimeField(auto_now_add=True)
    modifyDate = models.DateTimeField(auto_now=True)
    likeLen = models.IntegerField(default=0)
    collectLen = models.IntegerField(default=0)
    acticleType = models.ForeignKey(ActicleType,on_delete=models.CASCADE)

# 评论
# content评论内容
# acticle文章id
class CommentList(models.Model):
    id = models.UUIDField(primary_key=True,default = uuid.uuid1)
    content = models.TextField()
    acticle = models.ForeignKey(ActicleList,on_delete=models.CASCADE)
